<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>利息计算系统</title>
    <link href="https://cdn.bootcdn.net/ajax/libs/twitter-bootstrap/5.3.0/css/bootstrap.min.css" rel="stylesheet">
    <link href="https://cdn.bootcdn.net/ajax/libs/bootstrap-icons/1.11.3/font/bootstrap-icons.min.css" rel="stylesheet">
    <style>
        .step-indicator {
            display: flex;
            justify-content: space-between;
            margin: 2rem 0;
        }
        .step {
            flex: 1;
            text-align: center;
            padding: 1rem;
            background: #f8f9fa;
            border-radius: 0.5rem;
        }
        .step.active {
            background: #0d6efd;
            color: white;
        }
        .upload-area {
            border: 2px dashed #dee2e6;
            padding: 3rem;
            text-align: center;
            cursor: pointer;
            transition: all 0.3s;
        }
        .upload-area:hover {
            border-color: #0d6efd;
            background: #f8f9fa;
        }
    </style>
</head>
<body>
    <div class="container py-5">
        <h1 class="mb-4 text-center">日度利息计算系统</h1>
        
        <!-- 步骤指示器 -->
        <div class="step-indicator">
            <div class="step active">1. 上传文件</div>
        </div>

        <!-- 错误提示 -->
        {% if error %}
        <div class="alert alert-danger">{{ error }}</div>
        {% endif %}

        <!-- 上传文件表单 -->
        <form method="post" enctype="multipart/form-data" action="/">
            <div class="mb-4">
                <div class="upload-area" onclick="document.getElementById('fileInput').click()">
                    <i class="bi bi-cloud-upload fs-1 text-primary"></i>
                    <h4 class="my-3">拖放文件或点击上传</h4>
                    <p class="text-muted">支持.xlsx格式，最大100MB</p>
                    <input type="file" class="form-control d-none" name="excel_file" 
                           id="fileInput" accept=".xlsx" required>
                </div>
                <button type="submit" class="btn btn-lg btn-primary mt-3 d-block mx-auto" id="uploadBtn" disabled>
                    <i class="bi bi-upload"></i> 确认上传
                </button>

            </div>
        </form>

    </div>

    <script>
        // 文件选择处理
        document.getElementById('fileInput').addEventListener('change', function(e) {
            const btn = document.getElementById('uploadBtn');
            if (this.files.length > 0) {
                btn.disabled = false;
                btn.innerHTML = `<i class="bi bi-upload"></i> 上传选中的文件 (${this.files[0].name})`;
            }
        });
    </script>
</body>
</html>
